import { Table } from '@builtIns';

# ProgressPlugin

This plugin can be used to configure the progress bar.

Rspack uses [indicatif::ProgressBar](https://github.com/console-rs/indicatif) to draw the progress bar.

```js
new rspack.ProgressPlugin(options);
```

## Options

### Function

Provide a handler function which will be called when hooks report progress. `handler` function arguments:

- `percentage`: a number between 0 and 1 indicating the completion percentage of the compilation
- `message`: a short description of the currently-executing hook
- `...args`: zero or more additional strings describing the current progress

```js
const handler = (percentage, message, ...args) => {
  // e.g. Output each progress message directly to the console:
  console.info(percentage, message, ...args);
};

new rspack.ProgressPlugin(handler);
```

### Object

#### prefix

- **Type:** `string`
- **Default:** `'Rspack'`

The text will be displayed before the progress bar.

#### profile

- **Type:** `boolean`
- **Default:** `false`

Tells `ProgressPlugin` to collect profile data for progress steps.

#### template

- **Type:** `string`
- **Default:** `● {prefix:.bold} {bar:25.green/white.dim} ({percent}%) {wide_msg:.dim}`

The template of progress bar.

Also see [indicatif::ProgressBar::with_template](https://docs.rs/indicatif/latest/indicatif/style/struct.ProgressStyle.html#method.with_template).

#### tick

- **Type:** `string | string[] | undefined`
- **Default:** `undefined`

The tick string sequence for spinners, if it's string then it will be split into characters.

Also see [indicatif::ProgressBar::tick_strings](https://docs.rs/indicatif/latest/indicatif/style/struct.ProgressStyle.html#method.tick_strings).

#### progressChars

- **Type:** `string`
- **Default:** `━━`

The progress characters `(filled, current, to do)`.

Also see [indicatif::ProgressBar::progress_chars](https://docs.rs/indicatif/latest/indicatif/style/struct.ProgressStyle.html#method.progress_chars).
